package cj.web.marriage.dao;
/*
 *  
 *  
*/
import java.util.List;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.marriage.domain.YYBooking;

/**
 * 
 * @author 
 *
 */
@DAO
public interface YYBookingDAO{
	
	@SQL("SELECT * FROM YYBooking WHERE deleteFlag=1 #if(:t.businessType!=-1){ AND businessType =:t.businessType } #if(:t.state!=-1){ AND state =:t.state } #if(:t.name!=''){ AND name LIKE '%##(:t.name)%' } #if(:t.phone!=''){ AND phone LIKE '%##(:t.phone)%' } ORDER BY updateAt DESC LIMIT :t.start,:t.length ")
    List<YYBooking> query(@SQLParam("t") YYBooking yYBooking);
	
	@SQL("SELECT count(1) FROM YYBooking WHERE deleteFlag=1 #if(:t.businessType!=-1){ AND businessType =:t.businessType } #if(:t.state!=-1){ AND state =:t.state } #if(:t.name!=''){ AND name LIKE '%##(:t.name)%' } #if(:t.phone!=''){ AND phone LIKE '%##(:t.phone)%' } ")
    int querysize(@SQLParam("t") YYBooking yYBooking);
    
    @SQL("SELECT * FROM YYBooking WHERE id=:1 ")
    YYBooking queryById(int id);
    
    @SQL("UPDATE YYBooking SET deleteFlag=0,updateAt=now() WHERE id=:1 ")
    void deleteById(int id);
    
    @SQL("UPDATE YYBooking SET state=1,updateAt=now() WHERE id=:1 ")
    void updateStateById(int id);
}